# ===================================================================
#  按钮样式常量 (Button Style Constants)
# ===================================================================

SUCCESS_BUTTON_STYLE = """
    QPushButton {
        background-color: #67c23a; color: white; font-weight: bold;
        border: 1px solid #58a632; border-radius: 4px; padding: 5px;
    }
    QPushButton:hover { background-color: #85ce61; }
    QPushButton:pressed { background-color: #58a632; }
    QPushButton:disabled { background-color: #b2d8a3; border-color: #b2d8a3; }
    QPushButton:disabled {
                background-color: #f4f4f5;
                border-color: #e9e9eb;
                color: #c0c4cc;
                font-weight: normal;
            }
"""

DANGER_BUTTON_STYLE = """
    QPushButton {
        background-color: #f56c6c; color: white; font-weight: bold;
        border: 1px solid #d45c5c; border-radius: 4px; padding: 5px;
    }
    QPushButton:hover { background-color: #f78989; }
    QPushButton:pressed { background-color: #d45c5c; }
    QPushButton:disabled { background-color: #fab6b6; border-color: #fab6b6; }
    QPushButton:disabled {
                background-color: #f4f4f5;
                border-color: #e9e9eb;
                color: #c0c4cc;
                font-weight: normal;
            }
"""

WARNING_BUTTON_STYLE = """
    QPushButton {
        background-color: #e6a23c; color: white; font-weight: bold;
        border: 1px solid #c88c32; border-radius: 4px; padding: 5px;
    }
    QPushButton:hover { background-color: #ebb563; }
    QPushButton:pressed { background-color: #c88c32; }
    QPushButton:disabled { background-color: #f3d19e; border-color: #f3d19e; }
    QPushButton:disabled {
                background-color: #f4f4f5;
                border-color: #e9e9eb;
                color: #c0c4cc;
                font-weight: normal;
            }
"""

# --- 青色 (Info) ---
INFO_BUTTON_STYLE = """
    QPushButton {
        background-color: #0dcaf0;
        color: white;
        font-weight: bold;
        border: 1px solid #0aa3c2;
        border-radius: 4px;
        padding: 5px;
    }
    QPushButton:hover { background-color: #31d2f2; }
    QPushButton:pressed { background-color: #0b9fb9; }
    QPushButton:disabled { background-color: #6edff6; border-color: #6edff6; }
    QPushButton:disabled {
            background-color: #f4f4f5;
            border-color: #e9e9eb;
            color: #c0c4cc;
            font-weight: normal;
        }
"""

# --- 灰色 (Secondary) ---
SECONDARY_BUTTON_STYLE = """
    QPushButton {
        background-color: #6c757d;
        color: white;
        font-weight: bold;
        border: 1px solid #5a6268;
        border-radius: 4px;
        padding: 5px;
    }
    QPushButton:hover { background-color: #868e96; }
    QPushButton:pressed { background-color: #5a6268; }
    QPushButton:disabled { background-color: #adb5bd; border-color: #adb5bd; }
"""

# --- 深灰色/黑色 (Dark) ---
DARK_BUTTON_STYLE = """
    QPushButton {
        background-color: #212529;
        color: white;
        font-weight: bold;
        border: 1px solid #1c2023;
        border-radius: 4px;
        padding: 5px;
    }
    QPushButton:hover { background-color: #343a40; }
    QPushButton:pressed { background-color: #1c2023; }
    QPushButton:disabled {
                background-color: #f4f4f5;
                border-color: #e9e9eb;
                color: #c0c4cc;
                font-weight: normal;
            }
"""

# --- 浅色 (Light) ---
LIGHT_BUTTON_STYLE = """
    QPushButton {
        background-color: #f8f9fa;
        color: #212529; /* 注意：浅色背景配深色文字 */
        font-weight: bold;
        border: 1px solid #dee2e6;
        border-radius: 4px;
        padding: 5px;
    }
    QPushButton:hover { background-color: #e2e6ea; }
    QPushButton:pressed { background-color: #dae0e5; }
    QPushButton:disabled {
                background-color: #f4f4f5;
                border-color: #e9e9eb;
                color: #c0c4cc;
                font-weight: normal;
            }
"""

# --- 蓝色 (Primary) ---
PRIMARY_BUTTON_STYLE = """
    QPushButton {
        background-color: #409eff; color: white; font-weight: bold;
        border: 1px solid #337ecc; border-radius: 4px; padding: 5px;
    }
    QPushButton:hover { background-color: #66b1ff; }
    QPushButton:pressed { background-color: #337ecc; }
    QPushButton:disabled {
                background-color: #f4f4f5;
                border-color: #e9e9eb;
                color: #c0c4cc;
                font-weight: normal;
            }
"""


GLOBAL_STYLE_SHEET = """
/* 全局设置，应用于所有QWidget */
QWidget {
    background-color: #f0f2f5; /* 浅灰色背景 */
    font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif; /* 优先使用更现代的字体 */
    color: #333; /* 深灰色文字 */
}

/* 主窗口特殊背景（如果需要）*/
QMainWindow {
    background-color: #e8ecf1;
}

QPushButton {
    background-color: #ffffff; /* 默认白色背景 */
    border: 1px solid #dcdfe6; /* 浅灰色边框 */
    padding: 8px 15px; /* 增加内边距，让按钮更大方 */
    border-radius: 4px; /* 圆角 */
    font-size: 14px;
    color: #606266;
}

/* 鼠标悬停效果 */
QPushButton:hover {
    background-color: #ecf5ff;
    color: #409eff;
    border-color: #c6e2ff;
}

/* 鼠标按下效果 */
QPushButton:pressed {
    background-color: #a0cfff;
    border-color: #a0cfff;
    color: #ffffff;
}

/* "连接" 和 "开始监控" 等主操作按钮 */
QPushButton[checkable="true"]:checked {
    background-color: #409eff; /* 主题蓝色 */
    border-color: #409eff;
    color: #ffffff;
}

QPushButton[checkable="true"]:checked:hover {
    background-color: #66b1ff;
    border-color: #66b1ff;
}

/* 禁用状态 */
QPushButton:disabled {
    background-color: #f4f4f5;
    border-color: #e9e9eb;
    color: #c0c4cc;
}

QGroupBox {
    border: 1px solid #dcdfe6;
    border-radius: 5px;
    margin-top: 10px; /* 为标题留出空间 */
    font-size: 15px;
    font-weight: bold;
}

QGroupBox::title {
    subcontrol-origin: margin;
    subcontrol-position: top left;
    left: 10px;
    padding: 0 5px;
    background-color: #f0f2f5; /* 与窗口背景色相同，制造"镂空"效果 */
}

QTableWidget {
    border: 1px solid #e0e0e0;
    gridline-color: #e0e0e0; /* 网格线颜色 */
    alternate-background-color: #fafafa; /* 隔行变色 */
}

QHeaderView::section {
    background-color: #f7f7f7;
    padding: 6px;
    border: none;
    border-bottom: 1px solid #e0e0e0;
    font-weight: bold;
    font-size: 13px;
}

QTableWidget::item {
    padding: 5px;
}

QTableWidget::item:selected {
    background-color: #d9ecff;
    color: #000;
}

QComboBox, QSpinBox, QDoubleSpinBox, QPlainTextEdit, QTextEdit {
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    padding: 5px;
    background-color: #fff;
}

QComboBox:focus, QSpinBox:focus, QDoubleSpinBox:focus, QPlainTextEdit:focus, QTextEdit:focus {
    border-color: #409eff; /* 聚焦时边框变蓝 */
}

QComboBox::drop-down {
    border: none;
}

QLCDNumber {
    background-color: #2c3e50; /* 深蓝灰色背景 */
    color: #18d4a3; /* 亮绿色数字 */
    border: 2px solid #283747;
    border-radius: 5px;
}
"""